﻿//------------------------------------------------------------------------------
// 创建标识: Copyright (C) 2008 Socansoft.com 版权所有
// 创建描述: SocanCode代码生成器自动创建于 2008-12-13 10:48:54
//
// 功能描述: 
//
// 修改标识: 
// 修改描述: 
//------------------------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class Controls_LEVELCHANGECONDListControl : System.Web.UI.UserControl
{
    private string _html;
    public string HTML
    {
        set { _html = value; }
        get { return _html; }
    } 
    public event RepeaterCommandEventHandler ItemCommand;
    public List<int> Selected
    {
        get
        {
            List<int> l = new List<int>();
            foreach (RepeaterItem item in rptLEVELCHANGECOND.Items)
            {
                CheckBox cb = item.FindControl("chkChoose") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld = item.FindControl("hfLEVELCHANGECOND") as HiddenField;
                    if (fld != null)
                    {
                        int id = Convert.ToInt32(fld.Value);
                        l.Add(id);
                    }
                }
            }
            return l;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void Bind(List<Model.LEVELCHANGECOND> l)
    {
        rptLEVELCHANGECOND.DataSource = l;
        rptLEVELCHANGECOND.DataBind();
    }

    protected void rptLEVELCHANGECOND_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (ItemCommand != null)
            ItemCommand(source, e);
    }

    protected void rptLEVELCHANGECOND_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string odid = ((HiddenField)e.Item.FindControl("hID")).Value;
            Model.LEVELCHANGECOND mode = new BLL.LEVELCHANGECOND().GetModel(Convert.ToInt32(odid)); //   .GetOrderNoteById(odid);
            if (mode != null)
            {
                if (mode.LCC_TYPE == "0")
                {
                    ((Label)e.Item.FindControl("LCC_TYPE")).Text = "积分";
                }
                else if (mode.LCC_TYPE == "1")
                {
                    ((Label)e.Item.FindControl("LCC_TYPE")).Text = "金额";
                }

                if (mode.LCC_ADDTIME == "0")
                {
                    ((Label)e.Item.FindControl("LCC_ADDTIME")).Text = "按月";
                }

                Model.V_CARSET carset = new BLL.V_CARSET().GetModel(mode.LCC_LEVEL);  //卡类别实体
                if (carset != null)
                {
                    ((Label)e.Item.FindControl("LCC_LEVEL")).Text = carset.MC; 
                }
            
            }

            //if (ds.Tables[0].Rows.Count > 0)
            //{
            //    HyperLink hl = (HyperLink)e.Item.FindControl("sdss");
            //    System.Drawing.Color a = System.Drawing.Color.FromName(ds.Tables[0].Rows[0]["ST_COLOR"].ToString().Trim());
            //    hl.BackColor = a;
            //    hl.ToolTip = ds.Tables[0].Rows[0]["ON_NOTE"].ToString();
            //}
            //string usercode = ((Label)e.Item.FindControl("lblUserCode")).Text.Trim();
            //string of = ((Label)e.Item.FindControl("lblOF")).ToolTip.Trim();
            ////string dt = ((Label)e.Item.FindControl("lblDT")).ToolTip.Trim();
            //Model.V_CUSTOMER u = new BLL.V_CUSTOMER().GetModel(usercode);
            //Model.ORDERFROM f = new BLL.ORDERFROM().GetModel(of);
            ////Model.DEALTYPE d = new BLL.DEALTYPE().GetModel(dt);
            //((Label)e.Item.FindControl("lblUserName")).Text = u.GKMC;
            //((Label)e.Item.FindControl("lblOF")).Text = f.OF_NAME;
            ////((Label)e.Item.FindControl("lblDT")).Text = d.DT_NAME;

            //HtmlTableCell promotionColumn = (HtmlTableCell)e.Item.FindControl("promotionColumn");
            //if (Share.IsExistPromoteSales == "0")
            //{
            //    promotionColumn.Visible = false;
            //}
            //else if (Share.IsExistPromoteSales == "1")
            //{
            //    promotionColumn.Visible = true;
            //}
        }
        if (e.Item.ItemType == ListItemType.Header)
        {
            //HtmlTableCell promotionColumn = (HtmlTableCell)e.Item.FindControl("promotionColumn");
            //if (Share.IsExistPromoteSales == "0")
            //{
            //    promotionColumn.Visible = false;
            //}
            //else if (Share.IsExistPromoteSales == "1")
            //{
            //    promotionColumn.Visible = true;
            //}
        }
    }


}
